<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>

<!--PC端页面公共导航栏-->
<div class="header-middle py-30">
    <div class="container">
        <div class="row align-items-center">
            <div class="col-lg-12">
                <div class="header-middle-wrap position-relative">

                    <!-- 首页logo -->
                    <a href="/bookmall/index" class="header-logo">
                        <img src="/images/logo.png" alt="Header Logo">
                    </a>

                    <div class="header-right">
                        <ul>
                            <!-- 搜索 -->
                            <li>
                                <a class="search-btn bt" data-bs-toggle="modal"
                                   data-bs-target="#searchModal" data-tippy="搜索">
                                    <i class="pe-7s-search"></i>
                                </a>
                            </li>

                            <c:choose>
                                <c:when test="${empty usered}">
                                    <li>
                                        <a href="/bookmall/login" data-tippy="登录">
                                            <i class="pe-7s-user"></i>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/bookmall/register" data-tippy="注册">
                                            <i class="pe-7s-add-user"></i>
                                        </a>
                                    </li>
                                </c:when>

                                <c:otherwise>
                                    <!-- 账户 -->
                                    <li class="dropdown d-none d-lg-block">
                                        <button class="btn btn-link dropdown-toggle ht-btn p-0" type="button"
                                                id="settingButton" data-bs-toggle="dropdown" aria-label="setting"
                                                aria-expanded="false" data-tippy="账户">
                                            <i class="pe-7s-users"></i>
                                        </button>
                                        <ul class="dropdown-menu" aria-labelledby="settingButton">
                                            <li>
                                                <a class="dropdown-item" href="/bookmall/center">个人信息</a>
                                                <a class="dropdown-item" href="/bookmall/logout">退出</a>
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <a href="/bookmall/order/myorders" data-tippy="我的订单">
                                            <i class="pe-7s-news-paper"></i>
                                        </a>
                                    </li>
                                </c:otherwise>
                            </c:choose>

                            <!-- 购物车 -->
                            <li class="minicart-wrap me-3 me-lg-0">
                                <a class="minicart-btn toolbar-btn" href="#miniCart" data-tippy="购物车">
                                    <i class="pe-7s-shopbag"></i>
                                    <!-- 数量 -->
                                    <c:choose>
                                        <c:when test="${empty order}">
                                            <span class="quantity">0</span>
                                        </c:when>
                                        <c:otherwise>
                                            <span class="quantity">${order.itemMap.size()}</span>
                                        </c:otherwise>
                                    </c:choose>
                                </a>
                            </li>

                            <c:if test="${usered.roleId==1}">
                                <li>
                                    <a href="/bookmall/admin/index" target="_blank" data-tippy="后台">
                                        <i class="pe-7s-tools"></i>
                                    </a>
                                </li>
                            </c:if>
                            <!-- 手机端菜单 -->
                            <li class="mobile-menu_wrap d-block d-lg-none">
                                <a class="mobile-menu_btn toolbar-btn pl-0" href="#mobileMenu">
                                    <i class="pe-7s-menu"></i></a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
